package com.jketing.entity.ams.sys;

import javax.persistence.Entity;
import javax.persistence.Table;

import com.jketing.entity.SortEntity;

/**
 * Operation 系统操作实体
 * 
 * @author  李荣华
 * @version v1.0
 * @date     2017-08-16
 * @since   Jpa 2.1
 */
//@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}) 不用getOne，换成findOne不用加本注解
@Entity
@Table(name = "Operation_")
public class Operation extends SortEntity<Operation>{	
	private static final long serialVersionUID = 5253770692330994864L;
	/**
	 * name:名称
	 */
	private String name;
	/**
	 * stamp:标记
	 */
	private String stamp;
	/**
	 * methodName:方法名称
	 */
	private String methodName;
	/**
	 * iconName:图标名称
	 */
	private String iconName;
	/**
	 * remark:备注
	 */
	private String remark; 

	/**
	 * name 系统按纽名称
	 */
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * stamp 操作标记，用于权限控制
	 */
	public String getStamp() {
		return stamp;
	}
	public void setStamp(String stamp) {
		this.stamp = stamp;
	}
	
	/**
	 * methodName 系统按纽方法名称
	 */
	public String getMethodName() {
		return methodName;
	}
	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	/**
	 * iconName 系统按纽图标名称
	 */
	public String getIconName() {
		return iconName;
	}
	public void setIconName(String iconName) {
		this.iconName = iconName;
	}

	/**
	 * remark 备注
	 */
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}

	/**
	 * 	equals 判断实例是否相等
	 * 
	 * 	是本类实例并且实例id值相等返回true
	 * 	其它情况返回false
	 * 
	 * 	@param object 其它实例
	 */
	@Override
	public boolean equals(Object object) {
		if (!(object instanceof Operation)) {
			return false;
		}
		Operation other = (Operation) object;
		if(!id.equals(other.id)){
			return false;
		}
		return true;
	}
	
	/**
	 * compareTo Comparable接口方法
	 * 	实体对象比较
	 * 	根据排序号差比较：本实例排序号减去其它同类实例排序号
	 * 	差大于0返回1
	 * 	差等于0返回0
	 * 	差小于0返回-1
	 * 	参数other为null或者不是本类的实例返回-1
	 * 
	 * @param  other 其它同类实例
	 */
	public int compareTo(Operation other) {
		if (other == null || !(other instanceof Operation))
			return -1;
		long temp = orderNumber - other.getOrderNumber();
		if (temp > 0)
			return 1;
		else if (temp == 0)
			return 0;
		else
			return -1;
	}
}
